<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>行情</title>
    <base id="base" href="${basePath}">
    <script src="js/base.js"></script>
    <link rel="stylesheet" type="text/css" href="css/index.css"/>
    <script src="js/trades/index.js"></script>
    <style>
        .chooseitem a{color: #FFF;display: inline-block;}
    </style>
</head>
<body ms-controller="root">
<!--<div class="headbar color_ef tc">行情</div>-->
<div class="national">
    	<span class="absolute l20 mt3" ms-click="toedit">编辑</span>
		<div class="ChooseNa w30">
        <div class='chooseitem w50 tc f12 fl ${domestic}'><a href="trade/index?isDomestic=0">国内</a></div>
        <div class="chooseitem w50 tc f12 fl ${notdomestic}"><a href="trade/index?isDomestic=1">国际</a></div>
    </div>
</div>
<div class="list_title f12 hidden color999 mt10">
    <div class="item_name fl w50">交易品种</div>
    <div class="item_name fl w25 tr">最新价</div>
    <div class="item_name fl w25 tr">涨跌幅<span class="updown inline_block uppic" ms-class-downpic="isup" ms-click="chooseup"></span></div>
</div>
<#list products as product>
    <div class="markets markets-a hidden" row-code="${product.code}">
        <div class="fl w50">
            <div class="f18"><span class="markets_span inline_block bgcolor_red f10 mr8">上</span>${product.name}</div>
            <div class="mt5 f10 colorccc"><span class="markets_span inline_block bgcolor_blu f10 mr8">主</span>${product.code}</div>
        </div>
        <div class="markets_num w25 fl f18 tr" id="lastPrice-${product.code}">${product.lastPrice}</div>
        <div class="markets_num w25 fl f18 tr" id="changeCount-${product.code}">${product.changeCount}%</div>
    </div>
</#list>
<div style="height: 52px;"></div>
<#--<#include "fragment/footer2.ftl">-->
<div ms-include-src="'../fragment/footer.html'"></div>
<script>

    var isDomestic = '${RequestParameters["isDomestic"]}';
    $(function () {
        // isDomestic=="1"?isDomestic=1:isDomestic=0;
        // alert(isDomestic);
        $(".markets-a").click(function () {
            window.location.href='trade/product?code='+$(this).attr("row-code");
        });
        setInterval("changeIndexData();",2000);
    });
    function changeIndexData() {
        $.get("trade/getIndexData",{"isDomestic":isDomestic},function (data) {
            data.forEach(function (val,i,arr) {
                $("#lastPrice-"+val.code).html(val.lastPrice);
                $("#changeCount-"+val.code).html(val.changeCount+"%");
            });
        });
    }
</script>
</body>
</html>
